package controller.admin.order;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import model.entity.Order;
import service.Impl.OrderServiceImpl;
import util.ResultUtil;

import java.io.IOException;
import java.util.List;

@WebServlet("/admin/order/conditionSearch")
public class OrderPageController extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int page= Integer.parseInt(req.getParameter("page"));
        int pageSize=Integer.parseInt(req.getParameter("pageSize"));
        String status=req.getParameter("status");
        String number=req.getParameter("number");
        String orderTime=req.getParameter("orderTime");
        OrderServiceImpl orderService=new OrderServiceImpl();

        List<Order> orderList=orderService.page(page,pageSize,status,number,orderTime);
        String json= ResultUtil.getJSON(orderList);
        resp.getWriter().write(json);
    }
}
